﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace FastUtil.Data
{
    public static class CopyUtil
    {
        public static T CopyObject<T>(T InputObject)
        {
            return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(InputObject));
        }

        public static List<T> CopyList<T>(List<T> InputList)
        {
            List<T> ObjectList = new List<T>();
            foreach (T item in InputList)
            {
                ObjectList.Add(CopyObject<T>(item));
            }
            return ObjectList;
        }
    }
}
